# -*-coding:utf-8 -*-
#
# Created on 2019/5/13, by felix
#

from django.urls import re_path
from rest_framework.routers import DefaultRouter

from apps.foreignkey.views import BookViewSet, PublishViewSet, V2BookViewSet, V3BookViewSet

# 100 Mode-View方式
# router = DefaultRouter(trailing_slash=False)  # 不需要 /
# router.register(r'book', BookViewSet, base_name='book')
# urlpatterns = router.urls

# 200 API-VIEW方式
urlpatterns = [
    # 序列化
    re_path(r'^publish/$', PublishViewSet.as_view()),
    re_path(r'^publish/(?P<pk>.*)/$', PublishViewSet.as_view()),

    # 序列化、反序列化分开（APIView)
    re_path(r'^book/$', BookViewSet.as_view()),
    re_path(r'^book/(?P<pk>.*)/$', BookViewSet.as_view()),

    # 序列化，反序列化整合（整合)(重点！！！）
    re_path(r'^v2book/$', V2BookViewSet.as_view()),
    re_path(r'^v2book/(?P<pk>.*)/$', V2BookViewSet.as_view()),

    # 群查、群增、群删、单整体改，单局部改
    # 单局部改、群局部改 ListModelSerializer
    re_path(r'^v3book/$', V3BookViewSet.as_view()),
    re_path(r'^v3book/(?P<pk>.*)/$', V3BookViewSet.as_view()),

]